@{
Layout=null;
}

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
  <meta name="viewport"
        content="width=device-width, initial-scale=1.0" />
  <title>@ViewData["Title"] - ShopForWeb.UI</title>
  <link rel="stylesheet"
        href="~/lib/bootstrap/dist/css/bootstrap.min.css" />

  <link rel="stylesheet"
        href="~/css/site.css"
        asp-append-version="true" />
  <link rel="stylesheet"
        href="~/ShopForWeb.UI.styles.css"
        asp-append-version="true" />

</head>

<body>
  <div class="container">
    <div class="row">
      <div class="col-12"
           style="height: 120px;">
      </div>
    </div>
    <div class="row">
      <div class="col-4 offset-4">
        <div class="card">
          <div class="card-header">
            管理员登录
          </div>
          <div class="card-body">
            <form>
              <div class="mb-3 row">
                <label for="phone"
                       class="col-sm-3 col-form-label">手机:</label>
                <div class="col-sm-9">
                  <input type="text"
                         class="form-control"
                         id="phone"
                         value="">
                </div>
              </div>

              <div class="mb-3 row">
                <label for="password"
                       class="col-sm-3 col-form-label">密码：</label>
                <div class="col-sm-9">
                  <input type="password"
                         class="form-control"
                         id="password">
                </div>
              </div>

              <div class="mb-3 row">
                <div class="col-12 text-center">
                  <button type="button"
                          id="btn-submit"
                          class="btn btn-primary mb-3">提交</button>
                  <button type="reset"
                          id="btn-reset"
                          class="btn btn-light mb-3">重置</button>
                </div>
              </div>
            </form>
          </div>
        </div>

      </div>
    </div>
  </div>


  <script src="~/lib/jquery/dist/jquery.min.js"></script>
  <script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
  <script src="~/js/site.js"
          asp-append-version="true"></script>


  <script>
    $(function () {
      //提交点击
      $("#btn-submit").on("click", function () {
        $.ajax({
          type: "post",
          url: "/admin/identity/login",
          data: {
            phone: $("#phone").val(),
            password: $("#password").val()
          },
          success: function (response) {
            alert(response.message);
            if (response.status == 0)
              location.href = "/admin";
          }
        });
      });
    });
  </script>
</body>

</html>
